import type { DirectiveBinding } from 'vue'
import { ElementBtn } from '@/types/directive'

// 按钮权限
function BtnDirective(el:ElementBtn, binding:DirectiveBinding) {
    let auth = localStorage.getItem('myAuth')
    let {value} = binding;
    if(!value.includes(auth)){
        // ElMessage.error('没有权限')
        // 禁止样式
        el.classList.add('is-disabled')
        // 禁止触发方法
        el.disabled="true"
    }
}

export default {
    mounted(el: ElementBtn, binding: DirectiveBinding) {
        BtnDirective(el, binding)
    },
}
